package com.bbzn.device.client.service.impl;

import com.bbzn.device.client.dto.fence.FenceDTO;
import com.bbzn.device.client.utils.PageInfo;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.bbzn.device.client.dao.fence.FenceMapper;
import com.bbzn.device.client.dataobject.Fence;
import com.bbzn.device.client.service.FenceService;

@Service
public class FenceServiceImpl implements FenceService {

    @Resource
    private FenceMapper fenceMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return fenceMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int deleteSelective(Fence record) {
        return fenceMapper.deleteSelective(record);
    }

    @Override
    public int insert(Fence record) {
        return fenceMapper.insert(record);
    }

    @Override
    public int insertOrUpdate(Fence record) {
        return fenceMapper.insertOrUpdate(record);
    }

    @Override
    public int insertOrUpdateSelective(Fence record) {
        return fenceMapper.insertOrUpdateSelective(record);
    }

    @Override
    public int insertSelective(Fence record) {
        return fenceMapper.insertSelective(record);
    }

    @Override
    public Fence selectByPrimaryKey(Long id) {
        return fenceMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Fence record) {
        return fenceMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Fence record) {
        return fenceMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<Fence> findByAll(Fence fence) {
        return fenceMapper.findByAll(fence);
    }

    @Override
    public int updateBatch(List<Fence> list) {
        return fenceMapper.updateBatch(list);
    }

    @Override
    public int batchInsert(List<Fence> list) {
        return fenceMapper.batchInsert(list);
    }

    @Override
    public PageInfo<Fence> findAllPageSelective(FenceDTO record) {
        PageInfo<Fence> pageInfo = new PageInfo<>();
        pageInfo.setPageNum(record.getPageNum());
        pageInfo.setPageSize(record.getPageSize());
        pageInfo.setResultList(fenceMapper.findPageByAll(record));
        int count = fenceMapper.findCountByAll(record);
        pageInfo.setTotalRecord(count);
        return pageInfo;
    }

    @Override
    public int findCountByAll(FenceDTO fence) {
        return fenceMapper.findCountByAll(fence);
    }

}


